<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>联系我们 - TechBlog</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            /* 亮色主题变量 */
            --bg-color: #ffffff;
            --text-color: #24292f;
            --border-color: #d0d7de;
            --card-bg: #f6f8fa;
            --header-bg: #f6f8fa;
            --accent-color: #0969da;
            --accent-hover: #0550ae;
            --code-bg: rgba(175, 184, 193, 0.2);
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
            --tag-bg: #ddf4ff;
            --tag-color: #0969da;
            --filter-bg: #f6f8fa;
            --input-bg: #ffffff;
            --section-spacing: 80px;
            --section-spacing-medium: 60px;
            --section-spacing-small: 40px;
            --success-color: #28a745;
            --error-color: #d73a49;
        }

        .dark-theme {
            /* 深色主题变量 */
            --bg-color: #0d1117;
            --text-color: #e6edf3;
            --border-color: #30363d;
            --card-bg: #161b22;
            --header-bg: #161b22;
            --accent-color: #2f81f7;
            --accent-hover: #1c6bdb;
            --code-bg: rgba(110, 118, 129, 0.4);
            --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7);
            --tag-bg: #388bfd26;
            --tag-color: #58a6ff;
            --filter-bg: #161b22;
            --input-bg: #0d1117;
            --success-color: #3fb950;
            --error-color: #f85149;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            transition: background-color 0.3s, color 0.3s, border-color 0.3s;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.5;
        }

        .container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* 区块间距系统 */
        .section {
            padding: var(--section-spacing) 0;
        }

        .section--medium {
            padding: var(--section-spacing-medium) 0;
        }

        .section--small {
            padding: var(--section-spacing-small) 0;
        }

        /* 头部导航 */
        header {
            background-color: var(--header-bg);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 0;
            position: relative;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 600;
            font-size: 20px;
            color: var(--text-color);
            text-decoration: none;
            z-index: 101;
        }

        .logo i {
            color: var(--accent-color);
        }

        .nav-links {
            display: flex;
            gap: 24px;
        }

        .nav-links a {
            color: var(--text-color);
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .nav-links a:hover {
            color: var(--accent-color);
        }

        .nav-links a.active {
            color: var(--accent-color);
            font-weight: 600;
        }

        .nav-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .theme-toggle {
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 8px 12px;
            color: var(--text-color);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            transition: all 0.2s ease;
        }

        .theme-toggle:hover {
            background-color: var(--code-bg);
        }

        .mobile-menu {
            display: none;
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-color);
            cursor: pointer;
            padding: 8px 12px;
            font-size: 16px;
            transition: all 0.2s ease;
        }

        .mobile-menu:hover {
            background-color: var(--code-bg);
        }

        /* 联系我们头部 */
        .contact-header {
            text-align: center;
            margin-bottom: 48px;
        }

        .contact-header h1 {
            font-size: 48px;
            font-weight: 700;
            margin-bottom: 16px;
            line-height: 1.2;
        }

        .contact-header p {
            font-size: 20px;
            margin-bottom: 32px;
            opacity: 0.8;
            line-height: 1.6;
            max-width: 700px;
            margin-left: auto;
            margin-right: auto;
        }

        /* 联系方式和表单区域 */
        .contact-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 48px;
            margin-bottom: 60px;
        }

        /* 联系方式卡片 */
        .contact-methods {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .contact-card {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 24px;
            transition: all 0.2s ease;
        }

        .contact-card:hover {
            border-color: var(--accent-color);
            transform: translateY(-2px);
        }

        .contact-icon {
            font-size: 32px;
            color: var(--accent-color);
            margin-bottom: 16px;
        }

        .contact-card h3 {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .contact-card p {
            font-size: 14px;
            opacity: 0.8;
            margin-bottom: 12px;
        }

        .contact-link {
            color: var(--accent-color);
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s ease;
        }

        .contact-link:hover {
            gap: 8px;
        }

        /* 联系表单 */
        .contact-form-container {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 32px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 600;
        }

        .form-input {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background-color: var(--input-bg);
            color: var(--text-color);
            font-size: 14px;
            transition: border-color 0.2s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
        }

        .dark-theme .form-input:focus {
            box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.2);
        }

        .form-textarea {
            min-height: 120px;
            resize: vertical;
        }

        .form-select {
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 16px;
            padding-right: 40px;
        }

        .btn {
            display: block;
            width: 100%;
            padding: 12px;
            background-color: var(--accent-color);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s ease;
        }

        .btn:hover {
            background-color: var(--accent-hover);
        }

        .btn:disabled {
            background-color: var(--border-color);
            cursor: not-allowed;
        }

        /* 错误消息 */
        .error-message {
            color: var(--error-color);
            font-size: 13px;
            margin-top: 4px;
            display: none;
        }

        .form-group.error .form-input {
            border-color: var(--error-color);
        }

        .form-group.error .error-message {
            display: block;
        }

        /* 成功消息 */
        .success-message {
            background-color: rgba(40, 167, 69, 0.1);
            border: 1px solid rgba(40, 167, 69, 0.3);
            border-radius: 6px;
            padding: 12px;
            margin-bottom: 16px;
            color: var(--success-color);
            font-size: 14px;
            display: none;
        }

        .dark-theme .success-message {
            background-color: rgba(63, 185, 80, 0.1);
            border-color: rgba(63, 185, 80, 0.3);
        }

        /* 常见问题区域 */
        .faq-section {
            margin-bottom: 40px;
        }

        .section-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 24px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-color);
        }

        .faq-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .faq-item {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            overflow: hidden;
        }

        .faq-question {
            padding: 20px 24px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 500;
            transition: background-color 0.2s ease;
        }

        .faq-question:hover {
            background-color: var(--code-bg);
        }

        .faq-question i {
            transition: transform 0.3s ease;
        }

        .faq-item.active .faq-question i {
            transform: rotate(180deg);
        }

        .faq-answer {
            padding: 0 24px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease, padding 0.3s ease;
        }

        .faq-item.active .faq-answer {
            padding: 0 24px 20px;
            max-height: 500px;
        }

        .faq-answer p {
            margin-bottom: 12px;
        }

        .faq-answer p:last-child {
            margin-bottom: 0;
        }

        /* 团队介绍 */
        .team-section {
            margin-bottom: 40px;
        }

        .team-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 24px;
        }

        .team-member {
            background-color: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 24px;
            text-align: center;
            transition: all 0.2s ease;
        }

        .team-member:hover {
            border-color: var(--accent-color);
            transform: translateY(-2px);
        }

        .member-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            margin: 0 auto 16px;
            object-fit: cover;
        }

        .member-name {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .member-role {
            font-size: 14px;
            color: var(--accent-color);
            margin-bottom: 12px;
        }

        .member-bio {
            font-size: 14px;
            opacity: 0.8;
            margin-bottom: 16px;
        }

        .member-social {
            display: flex;
            justify-content: center;
            gap: 12px;
        }

        .member-social a {
            color: var(--text-color);
            opacity: 0.7;
            transition: all 0.2s ease;
        }

        .member-social a:hover {
            color: var(--accent-color);
            opacity: 1;
        }

        /* 页脚 */
        footer {
            border-top: 1px solid var(--border-color);
            padding: 32px 0;
            text-align: center;
            font-size: 14px;
            color: var(--text-color);
            opacity: 0.8;
        }

        /* 响应式设计优化 */
        @media (max-width: 1024px) {
            .contact-content {
                grid-template-columns: 1fr;
                gap: 32px;
            }
        }

        @media (max-width: 768px) {
            .container {
                padding: 0 16px;
            }

            .navbar {
                padding: 12px 0;
            }

            .logo {
                font-size: 18px;
            }

            .nav-links {
                position: absolute;
                top: 100%;
                left: 0;
                width: 100%;
                background-color: var(--header-bg);
                border-top: 1px solid var(--border-color);
                flex-direction: column;
                padding: 16px 20px;
                display: none;
                box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            }

            .nav-links.active {
                display: flex;
            }

            .nav-links a {
                padding: 12px 0;
                border-bottom: 1px solid var(--border-color);
                font-size: 16px;
            }

            .nav-links a:last-child {
                border-bottom: none;
            }

            .mobile-menu {
                display: block;
                min-height: 44px;
                min-width: 44px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .theme-toggle,
            .mobile-menu {
                padding: 10px 14px;
            }

            .contact-header h1 {
                font-size: 36px;
            }

            .contact-header p {
                font-size: 18px;
            }

            .contact-form-container {
                padding: 24px;
            }

            .contact-card {
                padding: 20px;
            }

            .team-member {
                padding: 16px;
            }

            .faq-question {
                padding: 16px 20px;
            }

            .faq-answer {
                padding: 0 20px;
            }

            .faq-item.active .faq-answer {
                padding: 0 20px 16px;
            }

            /* 减少移动端的动画效果 */
            * {
                transition: none;
            }

            /* 保留必要的过渡 */
            .theme-toggle,
            .mobile-menu,
            .nav-links a,
            .btn,
            .contact-link,
            .contact-card,
            .team-member {
                transition: all 0.2s ease;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0 12px;
            }

            .contact-header h1 {
                font-size: 32px;
            }

            .contact-header p {
                font-size: 16px;
            }

            .contact-form-container {
                padding: 20px;
            }

            .contact-card {
                padding: 16px;
            }

            .team-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>

<body class="light-theme">
    <header>
        <div class="container">
            <nav class="navbar">
                <a href="index.html" class="logo">
                    <i class="fas fa-code"></i>
                    TechBlog
                </a>

                <div class="nav-links">
                    <a href="index.html">首页</a>
                    <a href="article-list.html">文章</a>
                    <a href="tutorial-list.html">教程</a>
                    <a href="projects.html">项目</a>
                    <a href="about.html">关于</a>
                    <a href="contact.html" class="active">联系我们</a>
                </div>

                <div class="nav-actions">
                    <button class="theme-toggle" id="themeToggle">
                        <i class="fas fa-moon"></i>
                        <span>深色模式</span>
                    </button>
                    <button class="mobile-menu" id="mobileMenu">
                        <i class="fas fa-bars"></i>
                    </button>
                </div>
            </nav>
        </div>
    </header>

    <div class="container">
        <div class="section section--medium">
            <!-- 联系我们头部 -->
            <div class="contact-header">
                <h1>联系我们</h1>
                <p>我们很乐意听取您的反馈、建议或问题。请选择最适合您需求的方式与我们联系。</p>
            </div>

            <!-- 联系方式和表单 -->
            <div class="contact-content">
                <!-- 联系方式 -->
                <div class="contact-methods">
                    <div class="contact-card">
                        <div class="contact-icon">
                            <i class="fas fa-envelope"></i>
                        </div>
                        <h3>邮箱支持</h3>
                        <p>发送邮件到我们的支持团队，我们将在24小时内回复您。</p>
                        <a href="mailto:support@techblog.com" class="contact-link">
                            发送邮件 <i class="fas fa-arrow-right"></i>
                        </a>
                    </div>

                    <div class="contact-card">
                        <div class="contact-icon">
                            <i class="fas fa-comments"></i>
                        </div>
                        <h3>社区论坛</h3>
                        <p>加入我们的社区论坛，与其他用户和开发者交流。</p>
                        <a href="community.html" class="contact-link">
                            访问论坛 <i class="fas fa-arrow-right"></i>
                        </a>
                    </div>

                    <div class="contact-card">
                        <div class="contact-icon">
                            <i class="fas fa-map-marker-alt"></i>
                        </div>
                        <h3>办公地址</h3>
                        <p>北京市朝阳区科技园区创新大厦15层</p>
                        <a href="https://maps.google.com" target="_blank" class="contact-link">
                            查看地图 <i class="fas fa-arrow-right"></i>
                        </a>
                    </div>

                    <div class="contact-card">
                        <div class="contact-icon">
                            <i class="fas fa-phone"></i>
                        </div>
                        <h3>电话咨询</h3>
                        <p>工作日 9:00-18:00 可拨打我们的客服热线。</p>
                        <a href="tel:+861012345678" class="contact-link">
                            +86 10 1234 5678 <i class="fas fa-arrow-right"></i>
                        </a>
                    </div>
                </div>

                <!-- 联系表单 -->
                <div class="contact-form-container">
                    <h3 class="section-title">发送消息</h3>

                    <div class="success-message" id="successMessage">
                        <i class="fas fa-check-circle"></i> 消息发送成功！我们将在24小时内回复您。
                    </div>

                    <form id="contactForm">
                        <div class="form-group">
                            <label for="name" class="form-label">姓名</label>
                            <input type="text" id="name" class="form-input" placeholder="请输入您的姓名" required>
                            <div class="error-message" id="nameError">请输入有效的姓名</div>
                        </div>

                        <div class="form-group">
                            <label for="email" class="form-label">邮箱</label>
                            <input type="email" id="email" class="form-input" placeholder="请输入您的邮箱" required>
                            <div class="error-message" id="emailError">请输入有效的邮箱地址</div>
                        </div>

                        <div class="form-group">
                            <label for="subject" class="form-label">主题</label>
                            <select id="subject" class="form-input form-select" required>
                                <option value="">请选择主题</option>
                                <option value="general">一般咨询</option>
                                <option value="technical">技术问题</option>
                                <option value="billing">账单问题</option>
                                <option value="feedback">功能建议</option>
                                <option value="bug">报告Bug</option>
                                <option value="other">其他</option>
                            </select>
                            <div class="error-message" id="subjectError">请选择主题</div>
                        </div>

                        <div class="form-group">
                            <label for="message" class="form-label">消息内容</label>
                            <textarea id="message" class="form-input form-textarea" placeholder="请详细描述您的问题或建议..."
                                required></textarea>
                            <div class="error-message" id="messageError">请输入消息内容</div>
                        </div>

                        <button type="submit" class="btn" id="submitBtn">发送消息</button>
                    </form>
                </div>
            </div>

            <!-- 常见问题 -->
            <section class="faq-section">
                <h2 class="section-title">常见问题</h2>
                <div class="faq-list">
                    <div class="faq-item">
                        <div class="faq-question">
                            <span>如何注册TechBlog账户？</span>
                            <i class="fas fa-chevron-down"></i>
                        </div>
                        <div class="faq-answer">
                            <p>注册TechBlog账户非常简单：</p>
                            <ol>
                                <li>点击页面右上角的"注册"按钮</li>
                                <li>输入您的邮箱地址和设置密码</li>
                                <li>完成邮箱验证（验证邮件可能会在垃圾邮件文件夹中）</li>
                                <li>填写个人资料信息（可选）</li>
                            </ol>
                            <p>您也可以使用GitHub或Google账户直接登录。</p>
                        </div>
                    </div>

                    <div class="faq-item">
                        <div class="faq-question">
                            <span>如何发布我的第一篇文章？</span>
                            <i class="fas fa-chevron-down"></i>
                        </div>
                        <div class="faq-answer">
                            <p>发布文章的步骤如下：</p>
                            <ol>
                                <li>登录您的账户</li>
                                <li>点击导航栏中的"写作"或访问发布页面</li>
                                <li>填写文章标题、摘要和选择分类</li>
                                <li>使用Markdown编辑器编写内容</li>
                                <li>添加相关标签以便其他用户发现</li>
                                <li>预览文章并点击"发布"</li>
                            </ol>
                            <p>您也可以先保存为草稿，稍后再发布。</p>
                        </div>
                    </div>

                    <div class="faq-item">
                        <div class="faq-question">
                            <span>我的文章为什么没有通过审核？</span>
                            <i class="fas fa-chevron-down"></i>
                        </div>
                        <div class="faq-answer">
                            <p>文章未通过审核可能有以下原因：</p>
                            <ul>
                                <li>内容涉及敏感话题或违反社区准则</li>
                                <li>包含广告或推广内容</li>
                                <li>存在大量语法错误或格式问题</li>
                                <li>内容质量不符合平台标准</li>
                                <li>涉嫌抄袭或侵犯版权</li>
                            </ul>
                            <p>如果您的文章未通过审核，我们会通过邮件说明具体原因。</p>
                        </div>
                    </div>
                </div>
            </section>

            <!-- 团队介绍 -->
            <section class="team-section">
                <h2 class="section-title">我们的团队</h2>
                <div class="team-grid">
                    <div class="team-member">
                        <img src="https://avatars.githubusercontent.com/u/583231?v=4" alt="团队成员" class="member-avatar">
                        <div class="member-name">张明</div>
                        <div class="member-role">技术支持主管</div>
                        <p class="member-bio">负责解答用户技术问题和平台使用指导。</p>
                        <div class="member-social">
                            <a href="#"><i class="fab fa-linkedin"></i></a>
                            <a href="#"><i class="fab fa-twitter"></i></a>
                            <a href="#"><i class="fab fa-github"></i></a>
                        </div>
                    </div>

                    <div class="team-member">
                        <img src="https://avatars.githubusercontent.com/u/583231?v=4" alt="团队成员" class="member-avatar">
                        <div class="member-name">李华</div>
                        <div class="member-role">社区经理</div>
                        <p class="member-bio">管理社区互动，处理用户反馈和建议。</p>
                        <div class="member-social">
                            <a href="#"><i class="fab fa-linkedin"></i></a>
                            <a href="#"><i class="fab fa-twitter"></i></a>
                            <a href="#"><i class="fab fa-weibo"></i></a>
                        </div>
                    </div>

                    <div class="team-member">
                        <img src="https://avatars.githubusercontent.com/u/583231?v=4" alt="团队成员" class="member-avatar">
                        <div class="member-name">王强</div>
                        <div class="member-role">产品经理</div>
                        <p class="member-bio">负责产品规划和功能改进，收集用户需求。</p>
                        <div class="member-social">
                            <a href="#"><i class="fab fa-linkedin"></i></a>
                            <a href="#"><i class="fab fa-twitter"></i></a>
                            <a href="#"><i class="fas fa-envelope"></i></a>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>

    <footer>
        <div class="container">
            <p>© 2023 TechBlog. 保留所有权利。</p>
            <p>采用 Github 风格设计 | 由开发者为开发者打造</p>
        </div>
    </footer>

    <script>
        // 主题切换功能
        const themeToggle = document.getElementById('themeToggle');
        const themeIcon = themeToggle.querySelector('i');
        const themeText = themeToggle.querySelector('span');

        // 检查本地存储的主题偏好
        const currentTheme = localStorage.getItem('theme') || 'light';
        if (currentTheme === 'dark') {
            document.body.classList.add('dark-theme');
            themeIcon.classList.remove('fa-moon');
            themeIcon.classList.add('fa-sun');
            themeText.textContent = '浅色模式';
        }

        themeToggle.addEventListener('click', () => {
            document.body.classList.toggle('dark-theme');

            if (document.body.classList.contains('dark-theme')) {
                themeIcon.classList.remove('fa-moon');
                themeIcon.classList.add('fa-sun');
                themeText.textContent = '浅色模式';
                localStorage.setItem('theme', 'dark');
            } else {
                themeIcon.classList.remove('fa-sun');
                themeIcon.classList.add('fa-moon');
                themeText.textContent = '深色模式';
                localStorage.setItem('theme', 'light');
            }
        });

        // 移动端菜单切换
        const mobileMenu = document.getElementById('mobileMenu');
        const navLinks = document.querySelector('.nav-links');
        const menuIcon = mobileMenu.querySelector('i');

        mobileMenu.addEventListener('click', () => {
            navLinks.classList.toggle('active');

            if (navLinks.classList.contains('active')) {
                menuIcon.classList.remove('fa-bars');
                menuIcon.classList.add('fa-times');
            } else {
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // 点击菜单外区域关闭菜单
        document.addEventListener('click', (e) => {
            if (!e.target.closest('.navbar') && navLinks.classList.contains('active')) {
                navLinks.classList.remove('active');
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // 窗口大小变化时调整菜单状态
        window.addEventListener('resize', () => {
            if (window.innerWidth > 768) {
                navLinks.classList.remove('active');
                menuIcon.classList.remove('fa-times');
                menuIcon.classList.add('fa-bars');
            }
        });

        // FAQ折叠展开功能
        document.querySelectorAll('.faq-question').forEach(question => {
            question.addEventListener('click', () => {
                const faqItem = question.parentElement;
                faqItem.classList.toggle('active');
            });
        });

        // 联系表单验证和提交
        const contactForm = document.getElementById('contactForm');
        const nameInput = document.getElementById('name');
        const emailInput = document.getElementById('email');
        const subjectInput = document.getElementById('subject');
        const messageInput = document.getElementById('message');
        const nameError = document.getElementById('nameError');
        const emailError = document.getElementById('emailError');
        const subjectError = document.getElementById('subjectError');
        const messageError = document.getElementById('messageError');
        const submitBtn = document.getElementById('submitBtn');
        const successMessage = document.getElementById('successMessage');

        // 验证姓名
        function validateName() {
            const name = nameInput.value.trim();
            const nameGroup = nameInput.closest('.form-group');

            if (name === '') {
                nameGroup.classList.add('error');
                nameError.textContent = '请输入姓名';
                return false;
            }

            if (name.length < 2) {
                nameGroup.classList.add('error');
                nameError.textContent = '姓名至少需要2个字符';
                return false;
            }

            nameGroup.classList.remove('error');
            return true;
        }

        // 验证邮箱
        function validateEmail() {
            const email = emailInput.value.trim();
            const emailGroup = emailInput.closest('.form-group');
            const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

            if (email === '') {
                emailGroup.classList.add('error');
                emailError.textContent = '请输入邮箱地址';
                return false;
            }

            if (!emailRegex.test(email)) {
                emailGroup.classList.add('error');
                emailError.textContent = '请输入有效的邮箱地址';
                return false;
            }

            emailGroup.classList.remove('error');
            return true;
        }

        // 验证主题
        function validateSubject() {
            const subject = subjectInput.value;
            const subjectGroup = subjectInput.closest('.form-group');

            if (subject === '') {
                subjectGroup.classList.add('error');
                subjectError.textContent = '请选择主题';
                return false;
            }

            subjectGroup.classList.remove('error');
            return true;
        }

        // 验证消息
        function validateMessage() {
            const message = messageInput.value.trim();
            const messageGroup = messageInput.closest('.form-group');

            if (message === '') {
                messageGroup.classList.add('error');
                messageError.textContent = '请输入消息内容';
                return false;
            }

            if (message.length < 10) {
                messageGroup.classList.add('error');
                messageError.textContent = '消息内容至少需要10个字符';
                return false;
            }

            messageGroup.classList.remove('error');
            return true;
        }

        // 实时验证
        nameInput.addEventListener('input', validateName);
        emailInput.addEventListener('input', validateEmail);
        subjectInput.addEventListener('change', validateSubject);
        messageInput.addEventListener('input', validateMessage);

        // 表单提交
        contactForm.addEventListener('submit', (e) => {
            e.preventDefault();

            const isNameValid = validateName();
            const isEmailValid = validateEmail();
            const isSubjectValid = validateSubject();
            const isMessageValid = validateMessage();

            if (isNameValid && isEmailValid && isSubjectValid && isMessageValid) {
                // 模拟提交过程
                submitBtn.disabled = true;
                submitBtn.textContent = '发送中...';

                // 模拟API调用延迟
                setTimeout(() => {
                    successMessage.style.display = 'block';

                    // 重置表单
                    setTimeout(() => {
                        contactForm.reset();
                        submitBtn.disabled = false;
                        submitBtn.textContent = '发送消息';

                        // 3秒后隐藏成功消息
                        setTimeout(() => {
                            successMessage.style.display = 'none';
                        }, 3000);
                    }, 1000);
                }, 1500);
            }
        });
    </script>
</body>

</html>